#include<cstdio>
long long n,r,l;
int main(){
	freopen("candy.in","r",stdin);
	freopen("candy.out","w",stdout);
	scanf("%lld %lld %lld",&n,&r,&l);
	if(r/n<l/n){printf("%lld",n-1);}
	else printf("%lld",l%n);
} 
